﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DTO;

public partial class UserControls_ContactControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public Person Person
    {
        set
        {
            ViewState["PersonId"] = value.Id;
            txtFirstName.Text = value.FirstName;
            txtLastName.Text = value.LastName;
            txtEmail.Text = value.Email;
            txtPhone.Text = value.Phone;
        }
        get
        {
            int id = Convert.ToInt32(ViewState["PersonId"]);
            Person person = new Person(id);
            person.FirstName = txtFirstName.Text.Trim();
            person.LastName = txtLastName.Text.Trim();
            person.Email = txtEmail.Text.Trim();
            person.Phone = txtPhone.Text.Trim();
            return person;
        }
    }
}